package com.example.mobile2021606129ly0330;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity_max extends AppCompatActivity {

    private EditText edMainA;
    private EditText edMainB;
    private EditText edMainC;
    private TextView textMainRes;
    private Button butRes;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_max);

        initView();
        butRes.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                int a = Integer.parseInt(edMainA.getText().toString());
                int b = Integer.parseInt(edMainB.getText().toString());
                int c = Integer.parseInt(edMainC.getText().toString());
                if (a < b) {
                    a = b;
                }
                if (a < c) {
                    a = c;
                }

                textMainRes.setText(a);

            }
        });

    }

    private void initView() {
        edMainA = (EditText) findViewById(R.id.ed_main_a);
        edMainB = (EditText) findViewById(R.id.ed_main_b);
        edMainC = (EditText) findViewById(R.id.ed_main_c);
        textMainRes = (TextView) findViewById(R.id.text_main_res);
        butRes = (Button) findViewById(R.id.but_res);
    }
}







